import {defineConfig} from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import {fileURLToPath, URL} from "node:url";

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [uni()],
    publicDir: 'public',
    cacheDir: 'node_modules/.vite',
    server: {
        port: 6161,
        proxy: {
            '/api': {
                target: 'https://memorials.cpolar.cn',
                secure:true,
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, ''),
            }
        }
    },
    resolve: {
        alias: {
            "@": fileURLToPath(new URL("./src", import.meta.url)),
            'views': fileURLToPath(new URL("./src/views", import.meta.url)),
            'utils': fileURLToPath(new URL("./src/utils", import.meta.url)),
            // '@components': fileURLToPath(new URL("./src/components", import.meta.url)),
        },
    }

});
